.CSS_START_components_popoverDialog {
  display: none;
}

.modal_dialog_reader {
  transform: translate(-50%, -50%);
  left: 50%;
  top: 50%;
  width: 776px;
  min-height: calc(100vh - 300px);
  max-width: calc(100vw - 60px);
  max-height: calc(100vh - 60px);
  border-radius: 10px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  // overflow: hidden auto;
  align-content: flex-start;
  color: var(--color-text-primary);
  position: fixed;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--color-gray-250);

  @media only screen and (height <= 700px) {
    min-height: 550px;
  }

  .settings_container {
    min-height: inherit;
  }


  > .settings_container {
    padding: 0 20px 0 30px;
    overflow: hidden auto;
  }

  &.modal_dialog_full {
    position: relative;
    box-sizing: border-box;

    &_full {
      width: calc(100vw - 60px);
      height: calc(100vh - 100px);
    }
  }
}

[data-theme="light"] {
  .modal_dialog_reader {
    box-shadow: 0 1px 10px 2px var(--color-gray-250);
    border: none;
  }
}

[data-theme="system"] {
  @media (prefers-color-scheme: light) {
    .modal_dialog_reader {
      box-shadow: 0 1px 10px 2px var(--color-gray-250);
      border: none;
    }
  }
}

.popover_dialog_reader {
  width: 370px;
  height: calc(100dvh - 114px);
  display: flex;
  margin-top: 50px;
  flex-direction: column;
  box-sizing: border-box;
  z-index: 100;
  background-color: var(--color-neutral-base);
  position: absolute;
  overflow: hidden;
  color: var(--color-text-primary);

  .pages .react_aria_ComboBox .my_combobox_container { 
    > * {
    margin: 0!important;
    }

    input {
      max-width: 70px!important;
    }
  } 

  .settings_container {
    height: calc(100dvh - 200px)!important;
    padding: 0;
    overflow: hidden auto;

    .settings_tab_container_reading_spacing {
      grid-template-columns: repeat(1, 1fr);
    }
  }

  .settings_tab .settings_reading_text .section {
    width: 90%;
  }

  .display_options_item {
    background-color: transparent;
    color: var(--color-text-primary);
    font-size: 12px;

    &:disabled {
      background-color: var(--color-gray-50);
    }
  }

  .docked_header + .react_aria_ComboBox {
    padding: 15px 20px!important;
    width: calc(100% - 40px);
    background-color: var(--color-header-docked);
    border-bottom: 1px solid var(--color-gray-100);

    .my_combobox_container {
      width: 310px;
      height: 30px;

      > button {
        width: 100%!important;
      }
    }
  }

  .goToPage {
    .react_aria_ComboBox .my_combobox_container input {
      padding-left: 10px!important;
    }

    .react_aria_ComboBox .my_combobox_container button {
      padding-left: 0!important; 
      margin: 0!important;
    }
  }

  .react_aria_ComboBox {
    // margin: 0;
    // padding: 0;
    padding-bottom: 15px;

    .my_combobox_container {
      width: 100%;
      min-width: 110px;
      height: 25px;
      background-color: var(--color-brand-secondary);
      color: var(--color-brand-primary);
      border-color: var(--color-brand-primary) !important;
      display: flex;
      align-items: center;

      &:has(#reader-settings-nav) {
        width: 100%;
        margin: 0 20px 0 5px;
      }

      > button {
        color: var(--color-brand-primary);

        > span {
          text-overflow: ellipsis;
          overflow: hidden;
          max-width: 120px;
          white-space: nowrap;
        }

        svg {
          fill: var(--color-brand-primary);
        }
      }

      input, > button {
        width: 100%;
        height: 20px;
        background-color: inherit;
        font-size: 14px;
        margin-left: 10px;
        padding: 0 !important;
        padding-left: 30px!important;
      }

      button {
        background-color: inherit;

        svg {
          margin-left: unset;
          background-color: unset;
        }
      }
    }
  }

  .bookmarks_line .bookmark_textArea {
    min-width: unset;
    width: 270px;
  } 
}


.docked_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background-color: var(--color-header-docked);
  border-bottom: 1px solid var(--color-gray-100);
  height: 32px;
  gap: 10px;

  .my_combobox_container button {
    min-width: 110px;
  }  

  &_controls {
    width: 135px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: nowrap;

    .button_transparency_icon {
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;

      svg {
        width: 16px;
        height: 16px;
      }
    }
  }
}

.toc_container {
  padding: 0;
  height: auto;
  list-style-type: none;
  font-size: 12px;
  font-weight: 400;

  >li > div[aria-level="1"] {
    font-weight: 600;
    font-size: 14px;
  }
}

.chapters_content {
  padding: 0;
  height: auto;
  list-style: none;

  & > li > div > a > span, & .line span {
    line-height: 1.5em;
  }

  .line, .subheading:not(.inert) {
    color: var(--color-text-primary);
    border-left: 2px solid transparent;
    transition: 200ms;
    width: fit-content;
    text-align: left;
    display: block;
    padding: 5px;
    margin: 5px 0;
    border-radius: 4px;
    
    &.active:not(.inert) {
      &:hover {
        background-color: var(--color-brand-secondary);
      }
    }
  }

  & .chapters_content {
    padding: 0 0 0 10px;
  }

  & .subheading:not(.inert) {
    &:hover {
      background-color: var(--color-brand-secondary) !important;
    }
  }

  .line {
    &:not(.inert) {
      cursor: pointer;
    }

    &:last-child {
      border-bottom: 0;
    }
  }
}

.search_container {
  display: flex;
  flex-direction: column;

  li a {
    width: calc(100% - 20px)!important;
  }

  .correspondances {
    padding: 0;
    margin: 0;
    padding-bottom: 0.4em;
    margin-bottom: 0.4em;
  }

  .subheading {
    font-weight: 600;
    font-size: 14px;
  }

  li[aria-level="1"] {
    color: var(--color-text-primary);
    border-left: 2px solid var(--color-brand-primary);
    transition: 200ms;
    width: 90%;
    text-align: left;
    display: block;
    padding: 5px;
    margin: 5px 0;
    background-color: var(--color-gray-50);
  }
}

.navigation_container {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;

  .pages {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: center;
    
    .react_aria_ComboBox {
      margin: 0;
      padding: 0;
    }
  }

  button {
    transition: 100ms;
    min-width: 24px
  }

  button svg {
    width: 20px;
    fill: var(--color-brand-primary);
    color: var(--color-brand-primary);
  }

  button:disabled {
    visibility: hidden;
  }

  .my_combobox_container {
    width: fit-content!important;
    padding-right: 0!important;

    button {
      width: fit-content;
      padding: 0 10px;
      
      svg {
        margin-left: unset;
      }
    }
  }

  // span {
  //   padding: 5px;
  //   border: 1px solid black;
  //   border-radius: 6px;
  //   margin: 0 5px;
  // }
}

.bookmarks_line {
  // width: calc(100% - 10px);
  position: relative;
  text-align: left;
  padding: 20px 0;
  font-size: 1rem;

  .bookmark_textArea {
    margin: 10px 0;
    width: 430px;
    min-width: 430px;
    // height: 100px;
    // min-height: 100px;
    max-width: 430px;
    // max-height: 100px;
    border: 1px solid rgb(118 118 118);
    border-radius: 3px;
    font-family: Nunito, sans-serif;

    &:focus {
      border: 2px solid var(--color-brand-primary);
    }
  }

  .bookmark_name {
    text-align: left;
  }

  .update_form input {
    width: 100%;
    border-radius: 6px;
  }

  .bookmark_infos {
    // width: 100%;
    display: flex;
    background-color: var(--color-gray-50);
    border-left: 2px solid var(--color-brand-primary);
    height: fit-content;
    padding: 0 10px;

    // @media (prefers-color-scheme: dark) {
    //   background-color: #2D2D2D;
    // }

    .button_secondary_blue, .button_primary_blue {
      min-width: unset;
      width: fit-content;
      height: 25px;
    }

    .bookmark_actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 10px;

      > div {
        display: inherit;
        align-items: center;
        gap: 5px;
        margin: 2px;

        p {
          margin: 0;
        }

        svg {
          width: 16px;
          height: 16px;
          padding: 5px;
        }
      }

      &_buttons svg {
        fill: var(--color-brand-primary-inverse);
        color: var(--color-brand-primary-inverse);
      }

      button {
        height: unset;

        &:focus {
          // border: 1px solid var(--color-brand-primary);
          border-radius: 5px;
          background-color: var(--color-brand-secondary);
        }
      }
    }
  }

  & > button {
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;

    & svg {
      width: 24px;
    }
  }

  & img {
    width: 30px;
    height: 30px;
    display: inline-block;
    vertical-align: top;
  }

  & .chapter_marker {
    vertical-align: top;
    position: relative;
    display: inline-block;
    flex: 1;
    font-size: 0.9rem;
    margin-right: 0.5rem;
  }

  & span {
    display: inline-block;
    vertical-align: top;
    margin-top: 5px;
    font-family: Nunito, sans-serif;
  }
}

.bookmarks_line:last-child {
  border-bottom: 0;
}

.chapter_marker .gauge {
  width: 100%;
  margin-top: 2px;
  height: 4px;
  background-color: var(--color-gray-250);

  & .fill {
    height: 100%;
    position: relative;
    width: 63%;
    background-color: var(--color-gray-850);
  }
}

.goToPage {
  text-align: center;

  .currentPage {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 20px 0 30px;

    svg {
      width: 20px;
    }
  }

  form {
    display: flex;
    align-items: start;
    gap: 20px;

    .form_group {
      height: 30px;
      width: 375px;

      .react_aria_Label {
        position: absolute;
        left: 10px;
        top: -13px;
        padding: 0 5px;
        background-color: var(--color-neutral-base);
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 250px;
        white-space: nowrap;
        line-height: 97%;
        height: unset;
    }

      & input {
        margin: 0;
      }

      label {
        margin: 0;
        top: -12px;
        position: absolute;
      }

      & *:disabled {
        cursor: not-allowed;
      }
    }

    select {
      width: 375px;
      height: 36px;
      padding: 2px;
      border-radius: 6px;
      border: 1px solid black;
      appearance: auto;
      box-sizing: border-box;
      margin: 0;
      margin-right: 5px;
    }

    button {
      padding: 3px 5px;
      text-wrap: nowrap;
      box-sizing: content-box;
      height: 28px;
      min-width: unset;

      svg {
        width: 15px;
        fill: var(--color-neutral-base)!important;
        color: var(--color-neutral-base)!important;
      }
    }
  }

  & .title {
    color: var(--color-text-reader);
    font-size: 1.1rem;
  }

  & .goToErrorMessage {
    color: var(--color-error-text);
  }
}

.gotopage_combobox {
  .react_aria_ComboBox .my_combobox_container {
    border: none;
    width: 100%;
    height: 100%;
    padding: 0;
    background-color: inherit;
    color: inherit;
    position: absolute;
    bottom: 0;
    left: 0;

    &:has(.react_aria_Input[data-focused]) {
    outline: none!important;
    }

    input {
      // width: calc(100% - 45px);
      outline: none!important;
    }

    .react_aria_Button svg {
      // width: 15px;
      color: var(--color-text-primary)!important;
    }
  }
}

// .pages {
//   input {
//     width: fit-content!important;
//     max-width: 80px;
//     padding: 0!important;
//     padding-left: 10px!important;
//   }
//   .react_aria_ComboBox .my_combobox_container {
//     background-color: var(--color-neutral-base)!important;
//     color: var(--color-text-primary)!important;
//     border-color: var(--color-text-primary)!important;
//     max-width: 100px!important;
//     button {
//       padding: 0 5px;
//     }
//   }
// }

.modal_dialog_reader .pages select, .popover_dialog_reader .pages select {
  width: 160px;
  height: 30px;
  padding: 0!important;
  // padding-left: 10px!important;
  text-align: center;
  border: 1px solid var(--color-gray-950);
  border-radius: 6px;
  display: flex;
  align-items: center;
  position: relative;
  padding-right: 0 !important;
  background-color: inherit;
  color: var(--color-text-primary);

  option {
    background-color: var(--color-neutral-base);
  }
}

.modal_dialog_reader, .popover_dialog_reader {
  .pages .react_aria_ComboBox .my_combobox_container {
    background-color: var(--color-neutral-base)!important;
    color: var(--color-text-primary)!important;
    border-color: var(--color-text-primary)!important;
    max-width: 100px!important;
    
    input {
      width: fit-content!important;
      max-width: 80px;
      padding: 0!important;
      padding-left: 10px!important;
    }

    button {
      padding: 0 5px!important;
    }
  } 
} 

.react_aria_ListBox {
  width: inherit;
  background-color: var(--color-neutral-base);
  color: var(--color-text-primary);
}

.react_aria_ComboBox [role="group"]:focus-within {
  outline: var(--color-brand-primary) solid 2px !important;
  outline-offset: -2px;
}

.delete_item_edition {
  color: var(--color-brand-primary);
  margin-left: 5px;

  &:hover {
    background-color: var(--color-neutral-base);
  }

  svg {
    color: var(--color-brand-primary)!important;
  }
}


.delete_item, .delete_item_edition {
  z-index: 1000;
  border: 1px solid var(--color-brand-primary);
  background-color: var(--color-brand-secondary);
  border-radius: 5px;
  transition: 200ms;

  button {
    padding: 5px;
    color: var(--color-brand-primary);
    height: unset;
    border-radius: 5px;

    &:hover {
      background-color: var(--color-neutral-base);
    }

    &:focus {
      background-color: var(--color-brand-primary);
      border: 1px solid var(--color-neutral-base);
      outline: 1px solid var(--color-brand-primary);
      color: var(--color-neutral-base);
    }

    svg {
      width: 10px;
    }
  }
}

.CSS_END_components_popoverDialog {
  display: none;
}
